home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / sail.tar / sail / dr_4.c < prev    next >
C/C++ Source or Header  |  1992-09-18  |  1KB  |  45 lines

  1. /*
  2.  * Copyright (c) 1983 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that this notice is preserved and that due credit is given
  7.  * to the University of California at Berkeley. The name of the University
  8.  * may not be used to endorse or promote products derived from this
  9.  * software without specific prior written permission. This software
  10.  * is provided ``as is'' without express or implied warranty.
  11.  */
  12.  
  13. #ifndef lint
  14. static char sccsid[] = "@(#)dr_4.c    5.2 (Berkeley) 3/9/88";
  15. #endif /* not lint */
  16.  
  17. #include "externs.h"
  18.  
  19. ungrap(from, to)
  20. register struct ship *from, *to;
  21. {
  22.     register k;
  23.     char friend;
  24.  
  25.     if ((k = grappled2(from, to)) == 0)
  26.         return;
  27.     friend = capship(from)->nationality == capship(to)->nationality;
  28.     while (--k >= 0) {
  29.         if (friend || die() < 3) {
  30.             cleangrapple(from, to, 0);
  31.             makesignal(from, "ungrappling %s (%c%c)", to);
  32.         }
  33.     }
  34. }
  35.  
  36. grap(from, to)
  37. register struct ship *from, *to;
  38. {
  39.     if (capship(from)->nationality != capship(to)->nationality && die() > 2)
  40.         return;
  41.     Write(W_GRAP, from, 0, to->file->index, 0, 0, 0);
  42.     Write(W_GRAP, to, 0, from->file->index, 0, 0, 0);
  43.     makesignal(from, "grappled with %s (%c%c)", to);
  44. }
  45.